package org.agony2d.gpu {
	import org.agony2d.gpu.core.GroupAA;
	import org.agony2d.core.agony_internal;
	
	use namespace agony_internal;
	
	/** [ StateGroupAA ]
	 *  [◆]
	 *  	1.  stateArgs
	 *  [◆◆]
	 *  	1.  reset
	 *  	2.  exit
	 */
public class StateGroupAA extends GroupAA {
  
    public function StateGroupAA( state:StateAA ) {
		this.setting(state.fullTexture, state.tinted, state.smoothing)
		m_state = state
		state.m_group = this
    }
	
	public function get stateArgs() : Array {
		return m_state.m_stateArgs
	}
	
	public function set stateArgs( v:Array ) : void {
		m_state.m_stateArgs = v
	}
	
	public function reset() : void {
		this.doExit()
		this.doStart()
	}
	
	public function exit() : void {
		this.doExit()
	}
	
	
	agony_internal var m_state:StateAA
	agony_internal var m_started:Boolean
	
	
	override agony_internal function dispose() : void {
		this.doExit()
		super.dispose()
	}
	
	agony_internal function doStart() : void {
		m_state.enter()
		m_started = true
	}
	
	agony_internal function doExit() : void {
		if (m_started) {
			m_state.exit()
			this.removeAllListeners()
			this.killAllNodes()
			m_started = false
		}
	}
	
}
}